package com.huanmin.osd.utils;

import com.huanmin.osd.demo1;

import java.io.File;

public class Tool {
    public static   String outPath(String prefix){
        ClassLoader classLoader = demo1.class.getClassLoader();
        String outputDir=classLoader.getResource("").getPath()+ prefix+"/";
        //去掉开头的 /
        outputDir=outputDir.substring(1);
        return  outputDir;
    }
    //删除指定目录下所有文件包括子目录
    public static void deleteDirAll(String dirPath) {
        File file = new File(dirPath);
        if (!file.exists()) {
            return;
        }
        if (file.isFile()) {
            file.delete();
            return;
        }
        File[] files = file.listFiles();
        for (File f : files) {
            deleteDirAll(f.getAbsolutePath());
        }
        file.delete();
    }
}
